﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using SmartSpace.Workflow;

namespace SsTool.Common
{
    /// <summary>
    /// Interaction logic for SelectEventTypeWindow.xaml
    /// </summary>
    public partial class SelectEventTypeWindow : Window
    {
        public EventType SelectedEventType { get; private set; }

        public SelectEventTypeWindow()
        {
            InitializeComponent();

            this.Loaded += new RoutedEventHandler(SelectDictionaryTypeWindow_Loaded);
        }

        void SelectDictionaryTypeWindow_Loaded(object sender, RoutedEventArgs e)
        {
            IWorkflowService service = App.Get<IWorkflowService>();
            _ctlListType.ItemsSource = service.FindEventTypes();
        }

        private void _ctlBtnSubmit_Click(object sender, RoutedEventArgs e)
        {
            SelectedEventType = _ctlListType.SelectedItem as EventType;
            if (this.SelectedEventType != null)
            {
                DialogResult = true;
            }
        }

        private void _ctlBtnCancel_Click(object sender, RoutedEventArgs e)
        {
            DialogResult = false;
        }
    }
}
